<!-- HTML header for doxygen 1.8.20-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=9"/>
	<meta name="generator" content="Doxygen 1.9.4"/>
	<meta name="viewport" content="width=device-width, initial-scale=1"/>
	<title>Raspberry Pi Pico SDK: hardware_pwm</title>
	<!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
	<script type="text/javascript" src="jquery.js"></script>
	<script type="text/javascript" src="dynsections.js"></script>
	<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
	<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
	<link href="doxygen.css" rel="stylesheet" type="text/css" />
	<link href="normalise.css" rel="stylesheet" type="text/css"/>
<link href="main.css" rel="stylesheet" type="text/css"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
	<div class="navigation-mobile">
		<div class="logo--mobile">
			<a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
		</div>
		<div class="navigation-toggle">
			<span class="line-1"></span>
			<span class="line-2">
				<p>Menu Toggle</p>
			</span>
			<span class="line-3"></span>
		</div>
	</div>
	<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
		<div class="logo">
			<a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
			<span style="display: inline-block; margin-top: 10px;">
				v2.1.0
			</span>
		</div>
		<div class="navigation-footer">
			<img src="logo-mobile.svg" alt="Raspberry Pi">
			<a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
		</div>
<!-- 		<div class="search">
			<form>
				<input type="search" name="search" id="search" placeholder="Search">
				<input type="submit" value="Search">
			</form>
		</div> -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('group__hardware__pwm.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">hardware_pwm<div class="ingroups"><a class="el" href="group__hardware.html">Hardware APIs</a></div></div></div>
</div><!--header-->
<div class="contents">

<p>Hardware Pulse Width Modulation (PWM) API.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:gab346f319fab9342c66d48bdcc9bb7430"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gab346f319fab9342c66d48bdcc9bb7430">PWM_DREQ_NUM</a>(slice_num)</td></tr>
<tr class="memdesc:gab346f319fab9342c66d48bdcc9bb7430"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the <a class="el" href="group__hardware__dma.html#ga8def0ea481095c94f3a0dd0b4fed999e">dreq_num_t</a> used for pacing DMA transfers for a given PWM slice.  <a href="group__hardware__pwm.html#gab346f319fab9342c66d48bdcc9bb7430">More...</a><br /></td></tr>
<tr class="separator:gab346f319fab9342c66d48bdcc9bb7430"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad7c4554b59132ddd4a9773cca4a27203"><td class="memItemLeft" align="right" valign="top"><a id="gad7c4554b59132ddd4a9773cca4a27203" name="gad7c4554b59132ddd4a9773cca4a27203"></a>
#define&#160;</td><td class="memItemRight" valign="bottom"><b>PWM_GPIO_SLICE_NUM</b>(gpio)</td></tr>
<tr class="memdesc:gad7c4554b59132ddd4a9773cca4a27203"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the PWM slice number for a given GPIO number. <br /></td></tr>
<tr class="separator:gad7c4554b59132ddd4a9773cca4a27203"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga799affc57db362720ea5f4a5aef381f8"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga799affc57db362720ea5f4a5aef381f8">PWM_DEFAULT_IRQ_NUM</a>()</td></tr>
<tr class="memdesc:ga799affc57db362720ea5f4a5aef381f8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the <a class="el" href="group__hardware__irq.html#gaf30862f51b5994ffd5863176a185d137">irq_num_t</a> for the default PWM IRQ.  <a href="group__hardware__pwm.html#ga799affc57db362720ea5f4a5aef381f8">More...</a><br /></td></tr>
<tr class="separator:ga799affc57db362720ea5f4a5aef381f8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="enum-members" name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:ga0a00197703c8606641488cfff3f660e6"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">pwm_clkdiv_mode</a> { <a class="el" href="group__hardware__pwm.html#gga0a00197703c8606641488cfff3f660e6acd3efbc3feaca58b87930008fdd8486b">PWM_DIV_FREE_RUNNING</a> = 0
, <a class="el" href="group__hardware__pwm.html#gga0a00197703c8606641488cfff3f660e6a186c27a4768fcb0c6930471db51861b7">PWM_DIV_B_HIGH</a> = 1
, <a class="el" href="group__hardware__pwm.html#gga0a00197703c8606641488cfff3f660e6ad9d2170532c2c9ab4016908544c8ad40">PWM_DIV_B_RISING</a> = 2
, <a class="el" href="group__hardware__pwm.html#gga0a00197703c8606641488cfff3f660e6a0b4afcaa75090169d3b7cbec4c0e2012">PWM_DIV_B_FALLING</a> = 3
 }</td></tr>
<tr class="memdesc:ga0a00197703c8606641488cfff3f660e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">PWM Divider mode settings.  <a href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">More...</a><br /></td></tr>
<tr class="separator:ga0a00197703c8606641488cfff3f660e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga8b2117d67a544f64c001f4f32c723eef"><td class="memItemLeft" align="right" valign="top">static uint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga8b2117d67a544f64c001f4f32c723eef">pwm_gpio_to_slice_num</a> (uint gpio)</td></tr>
<tr class="memdesc:ga8b2117d67a544f64c001f4f32c723eef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine the PWM slice that is attached to the specified GPIO.  <a href="group__hardware__pwm.html#ga8b2117d67a544f64c001f4f32c723eef">More...</a><br /></td></tr>
<tr class="separator:ga8b2117d67a544f64c001f4f32c723eef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga96ba504fe00cb8e0d88f0730cdfdaafc"><td class="memItemLeft" align="right" valign="top">static uint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga96ba504fe00cb8e0d88f0730cdfdaafc">pwm_gpio_to_channel</a> (uint gpio)</td></tr>
<tr class="memdesc:ga96ba504fe00cb8e0d88f0730cdfdaafc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Determine the PWM channel that is attached to the specified GPIO.  <a href="group__hardware__pwm.html#ga96ba504fe00cb8e0d88f0730cdfdaafc">More...</a><br /></td></tr>
<tr class="separator:ga96ba504fe00cb8e0d88f0730cdfdaafc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga031fe8a502c9640ed4f5fab74d6248ae"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga031fe8a502c9640ed4f5fab74d6248ae">pwm_config_set_phase_correct</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, bool phase_correct)</td></tr>
<tr class="memdesc:ga031fe8a502c9640ed4f5fab74d6248ae"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set phase correction in a PWM configuration.  <a href="group__hardware__pwm.html#ga031fe8a502c9640ed4f5fab74d6248ae">More...</a><br /></td></tr>
<tr class="separator:ga031fe8a502c9640ed4f5fab74d6248ae"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga679802450ac829eff368e8f109df387e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga679802450ac829eff368e8f109df387e">pwm_config_set_clkdiv</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, float div)</td></tr>
<tr class="memdesc:ga679802450ac829eff368e8f109df387e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM clock divider in a PWM configuration.  <a href="group__hardware__pwm.html#ga679802450ac829eff368e8f109df387e">More...</a><br /></td></tr>
<tr class="separator:ga679802450ac829eff368e8f109df387e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga87232650c2d7cc3a92bb6cf7a3d0756b"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga87232650c2d7cc3a92bb6cf7a3d0756b">pwm_config_set_clkdiv_int_frac4</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, uint32_t div_int, uint8_t div_frac4)</td></tr>
<tr class="memdesc:ga87232650c2d7cc3a92bb6cf7a3d0756b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM clock divider in a PWM configuration using an 8:4 fractional value.  <a href="group__hardware__pwm.html#ga87232650c2d7cc3a92bb6cf7a3d0756b">More...</a><br /></td></tr>
<tr class="separator:ga87232650c2d7cc3a92bb6cf7a3d0756b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga120a17d77d42bb3a0e9e9510677ed61a"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga120a17d77d42bb3a0e9e9510677ed61a">pwm_config_set_clkdiv_int</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, uint32_t div_int)</td></tr>
<tr class="memdesc:ga120a17d77d42bb3a0e9e9510677ed61a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM clock divider in a PWM configuration.  <a href="group__hardware__pwm.html#ga120a17d77d42bb3a0e9e9510677ed61a">More...</a><br /></td></tr>
<tr class="separator:ga120a17d77d42bb3a0e9e9510677ed61a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga27a86a921b2ad2ebd811db1255d34d06"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga27a86a921b2ad2ebd811db1255d34d06">pwm_config_set_clkdiv_mode</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, enum <a class="el" href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">pwm_clkdiv_mode</a> mode)</td></tr>
<tr class="memdesc:ga27a86a921b2ad2ebd811db1255d34d06"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM counting mode in a PWM configuration.  <a href="group__hardware__pwm.html#ga27a86a921b2ad2ebd811db1255d34d06">More...</a><br /></td></tr>
<tr class="separator:ga27a86a921b2ad2ebd811db1255d34d06"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab459185e217d5e215dae3cfb3d6de1b5"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gab459185e217d5e215dae3cfb3d6de1b5">pwm_config_set_output_polarity</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, bool a, bool b)</td></tr>
<tr class="memdesc:gab459185e217d5e215dae3cfb3d6de1b5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set output polarity in a PWM configuration.  <a href="group__hardware__pwm.html#gab459185e217d5e215dae3cfb3d6de1b5">More...</a><br /></td></tr>
<tr class="separator:gab459185e217d5e215dae3cfb3d6de1b5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad6cf6d9237144234732a50eb6d5e4fe9"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gad6cf6d9237144234732a50eb6d5e4fe9">pwm_config_set_wrap</a> (<a class="el" href="structpwm__config.html">pwm_config</a> *c, uint16_t wrap)</td></tr>
<tr class="memdesc:gad6cf6d9237144234732a50eb6d5e4fe9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM counter wrap value in a PWM configuration.  <a href="group__hardware__pwm.html#gad6cf6d9237144234732a50eb6d5e4fe9">More...</a><br /></td></tr>
<tr class="separator:gad6cf6d9237144234732a50eb6d5e4fe9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga01d3e90bb7aa9a8b6884eddbfbebc175"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga01d3e90bb7aa9a8b6884eddbfbebc175">pwm_init</a> (uint slice_num, <a class="el" href="structpwm__config.html">pwm_config</a> *c, bool start)</td></tr>
<tr class="memdesc:ga01d3e90bb7aa9a8b6884eddbfbebc175"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialise a PWM with settings from a configuration object.  <a href="group__hardware__pwm.html#ga01d3e90bb7aa9a8b6884eddbfbebc175">More...</a><br /></td></tr>
<tr class="separator:ga01d3e90bb7aa9a8b6884eddbfbebc175"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad76f94a6dd6133c52284b6be8ae98e16"><td class="memItemLeft" align="right" valign="top">static <a class="el" href="structpwm__config.html">pwm_config</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gad76f94a6dd6133c52284b6be8ae98e16">pwm_get_default_config</a> (void)</td></tr>
<tr class="memdesc:gad76f94a6dd6133c52284b6be8ae98e16"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a set of default values for PWM configuration.  <a href="group__hardware__pwm.html#gad76f94a6dd6133c52284b6be8ae98e16">More...</a><br /></td></tr>
<tr class="separator:gad76f94a6dd6133c52284b6be8ae98e16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6f8fe346e6912cfab3d36b00043a3627"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga6f8fe346e6912cfab3d36b00043a3627">pwm_set_wrap</a> (uint slice_num, uint16_t wrap)</td></tr>
<tr class="memdesc:ga6f8fe346e6912cfab3d36b00043a3627"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the current PWM counter wrap value.  <a href="group__hardware__pwm.html#ga6f8fe346e6912cfab3d36b00043a3627">More...</a><br /></td></tr>
<tr class="separator:ga6f8fe346e6912cfab3d36b00043a3627"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga18a2b3bbc240d1a9b36526d69c06ec3d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga18a2b3bbc240d1a9b36526d69c06ec3d">pwm_set_chan_level</a> (uint slice_num, uint chan, uint16_t level)</td></tr>
<tr class="memdesc:ga18a2b3bbc240d1a9b36526d69c06ec3d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the current PWM counter compare value for one channel.  <a href="group__hardware__pwm.html#ga18a2b3bbc240d1a9b36526d69c06ec3d">More...</a><br /></td></tr>
<tr class="separator:ga18a2b3bbc240d1a9b36526d69c06ec3d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae7064c88717eee935e50138f5b0ae2b7"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gae7064c88717eee935e50138f5b0ae2b7">pwm_set_both_levels</a> (uint slice_num, uint16_t level_a, uint16_t level_b)</td></tr>
<tr class="memdesc:gae7064c88717eee935e50138f5b0ae2b7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM counter compare values.  <a href="group__hardware__pwm.html#gae7064c88717eee935e50138f5b0ae2b7">More...</a><br /></td></tr>
<tr class="separator:gae7064c88717eee935e50138f5b0ae2b7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga279d1ba7dcc8f19619f389317efb41fd"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga279d1ba7dcc8f19619f389317efb41fd">pwm_set_gpio_level</a> (uint gpio, uint16_t level)</td></tr>
<tr class="memdesc:ga279d1ba7dcc8f19619f389317efb41fd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper function to set the PWM level for the slice and channel associated with a GPIO.  <a href="group__hardware__pwm.html#ga279d1ba7dcc8f19619f389317efb41fd">More...</a><br /></td></tr>
<tr class="separator:ga279d1ba7dcc8f19619f389317efb41fd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga157c8b11483967714823187725a5ed5a"><td class="memItemLeft" align="right" valign="top">static uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga157c8b11483967714823187725a5ed5a">pwm_get_counter</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga157c8b11483967714823187725a5ed5a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get PWM counter.  <a href="group__hardware__pwm.html#ga157c8b11483967714823187725a5ed5a">More...</a><br /></td></tr>
<tr class="separator:ga157c8b11483967714823187725a5ed5a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5179ec971146ab611b9232587e945769"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga5179ec971146ab611b9232587e945769">pwm_set_counter</a> (uint slice_num, uint16_t c)</td></tr>
<tr class="memdesc:ga5179ec971146ab611b9232587e945769"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM counter.  <a href="group__hardware__pwm.html#ga5179ec971146ab611b9232587e945769">More...</a><br /></td></tr>
<tr class="separator:ga5179ec971146ab611b9232587e945769"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga98a47b25fcc2f28addf0a28ee3234efd"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga98a47b25fcc2f28addf0a28ee3234efd">pwm_advance_count</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga98a47b25fcc2f28addf0a28ee3234efd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Advance PWM count.  <a href="group__hardware__pwm.html#ga98a47b25fcc2f28addf0a28ee3234efd">More...</a><br /></td></tr>
<tr class="separator:ga98a47b25fcc2f28addf0a28ee3234efd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0dec65009d8c0738677818b680fd2ad9"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga0dec65009d8c0738677818b680fd2ad9">pwm_retard_count</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga0dec65009d8c0738677818b680fd2ad9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retard PWM count.  <a href="group__hardware__pwm.html#ga0dec65009d8c0738677818b680fd2ad9">More...</a><br /></td></tr>
<tr class="separator:ga0dec65009d8c0738677818b680fd2ad9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0a2f35d5e2e1ddfd84f2ecab43d765e2"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga0a2f35d5e2e1ddfd84f2ecab43d765e2">pwm_set_clkdiv_int_frac4</a> (uint slice_num, uint8_t div_int, uint8_t div_frac4)</td></tr>
<tr class="memdesc:ga0a2f35d5e2e1ddfd84f2ecab43d765e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM clock divider using an 8:4 fractional value.  <a href="group__hardware__pwm.html#ga0a2f35d5e2e1ddfd84f2ecab43d765e2">More...</a><br /></td></tr>
<tr class="separator:ga0a2f35d5e2e1ddfd84f2ecab43d765e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga94782fc53adb07a3594ae0939d9a2e3e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga94782fc53adb07a3594ae0939d9a2e3e">pwm_set_clkdiv</a> (uint slice_num, float divider)</td></tr>
<tr class="memdesc:ga94782fc53adb07a3594ae0939d9a2e3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM clock divider.  <a href="group__hardware__pwm.html#ga94782fc53adb07a3594ae0939d9a2e3e">More...</a><br /></td></tr>
<tr class="separator:ga94782fc53adb07a3594ae0939d9a2e3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab12ab09d76aed43a36f973232718fdd6"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gab12ab09d76aed43a36f973232718fdd6">pwm_set_output_polarity</a> (uint slice_num, bool a, bool b)</td></tr>
<tr class="memdesc:gab12ab09d76aed43a36f973232718fdd6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM output polarity.  <a href="group__hardware__pwm.html#gab12ab09d76aed43a36f973232718fdd6">More...</a><br /></td></tr>
<tr class="separator:gab12ab09d76aed43a36f973232718fdd6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1ee213ebb13b98dc81e60a512f696227"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga1ee213ebb13b98dc81e60a512f696227">pwm_set_clkdiv_mode</a> (uint slice_num, enum <a class="el" href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">pwm_clkdiv_mode</a> mode)</td></tr>
<tr class="memdesc:ga1ee213ebb13b98dc81e60a512f696227"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM divider mode.  <a href="group__hardware__pwm.html#ga1ee213ebb13b98dc81e60a512f696227">More...</a><br /></td></tr>
<tr class="separator:ga1ee213ebb13b98dc81e60a512f696227"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gacb2a1995f0bfdb12345607b903c3f11e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gacb2a1995f0bfdb12345607b903c3f11e">pwm_set_phase_correct</a> (uint slice_num, bool phase_correct)</td></tr>
<tr class="memdesc:gacb2a1995f0bfdb12345607b903c3f11e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set PWM phase correct on/off.  <a href="group__hardware__pwm.html#gacb2a1995f0bfdb12345607b903c3f11e">More...</a><br /></td></tr>
<tr class="separator:gacb2a1995f0bfdb12345607b903c3f11e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga216496c331542eb57199018fa86b4408"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga216496c331542eb57199018fa86b4408">pwm_set_enabled</a> (uint slice_num, bool enabled)</td></tr>
<tr class="memdesc:ga216496c331542eb57199018fa86b4408"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable/Disable PWM.  <a href="group__hardware__pwm.html#ga216496c331542eb57199018fa86b4408">More...</a><br /></td></tr>
<tr class="separator:ga216496c331542eb57199018fa86b4408"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga257ea7fd33fcf33815a01dd279ca578d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga257ea7fd33fcf33815a01dd279ca578d">pwm_set_mask_enabled</a> (uint32_t mask)</td></tr>
<tr class="memdesc:ga257ea7fd33fcf33815a01dd279ca578d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable/Disable multiple PWM slices simultaneously.  <a href="group__hardware__pwm.html#ga257ea7fd33fcf33815a01dd279ca578d">More...</a><br /></td></tr>
<tr class="separator:ga257ea7fd33fcf33815a01dd279ca578d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga093a3c371dda3aa2291331147337265e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga093a3c371dda3aa2291331147337265e">pwm_set_irq_enabled</a> (uint slice_num, bool enabled)</td></tr>
<tr class="memdesc:ga093a3c371dda3aa2291331147337265e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable PWM instance interrupt via the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350)  <a href="group__hardware__pwm.html#ga093a3c371dda3aa2291331147337265e">More...</a><br /></td></tr>
<tr class="separator:ga093a3c371dda3aa2291331147337265e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga79aa7a5ac3e6960ed1c8eda99cddb1a9"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga79aa7a5ac3e6960ed1c8eda99cddb1a9">pwm_set_irq0_enabled</a> (uint slice_num, bool enabled)</td></tr>
<tr class="memdesc:ga79aa7a5ac3e6960ed1c8eda99cddb1a9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable PWM instance interrupt via PWM_IRQ_WRAP_0.  <a href="group__hardware__pwm.html#ga79aa7a5ac3e6960ed1c8eda99cddb1a9">More...</a><br /></td></tr>
<tr class="separator:ga79aa7a5ac3e6960ed1c8eda99cddb1a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2ea24b74474d2a7095ab1a9e409fa85e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga2ea24b74474d2a7095ab1a9e409fa85e">pwm_irqn_set_slice_enabled</a> (uint irq_index, uint slice_num, bool enabled)</td></tr>
<tr class="memdesc:ga2ea24b74474d2a7095ab1a9e409fa85e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable PWM instance interrupt via either PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1.  <a href="group__hardware__pwm.html#ga2ea24b74474d2a7095ab1a9e409fa85e">More...</a><br /></td></tr>
<tr class="separator:ga2ea24b74474d2a7095ab1a9e409fa85e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gac32a9b468ddbd49bad6ebff6789fd215"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gac32a9b468ddbd49bad6ebff6789fd215">pwm_set_irq_mask_enabled</a> (uint32_t slice_mask, bool enabled)</td></tr>
<tr class="memdesc:gac32a9b468ddbd49bad6ebff6789fd215"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable multiple PWM instance interrupts via the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350)  <a href="group__hardware__pwm.html#gac32a9b468ddbd49bad6ebff6789fd215">More...</a><br /></td></tr>
<tr class="separator:gac32a9b468ddbd49bad6ebff6789fd215"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gade21c4c94d2dce96bb4992d818909f0e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gade21c4c94d2dce96bb4992d818909f0e">pwm_set_irq0_mask_enabled</a> (uint32_t slice_mask, bool enabled)</td></tr>
<tr class="memdesc:gade21c4c94d2dce96bb4992d818909f0e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable multiple PWM instance interrupts via PWM_IRQ_WRAP_0.  <a href="group__hardware__pwm.html#gade21c4c94d2dce96bb4992d818909f0e">More...</a><br /></td></tr>
<tr class="separator:gade21c4c94d2dce96bb4992d818909f0e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6c5a284b10961cd0f73e22684df691f0"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga6c5a284b10961cd0f73e22684df691f0">pwm_irqn_set_slice_mask_enabled</a> (uint irq_index, uint slice_mask, bool enabled)</td></tr>
<tr class="memdesc:ga6c5a284b10961cd0f73e22684df691f0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable PWM instance interrupts via either PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1.  <a href="group__hardware__pwm.html#ga6c5a284b10961cd0f73e22684df691f0">More...</a><br /></td></tr>
<tr class="separator:ga6c5a284b10961cd0f73e22684df691f0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8d4482b5e125e30bc166d3ed33d8ba2d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga8d4482b5e125e30bc166d3ed33d8ba2d">pwm_clear_irq</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga8d4482b5e125e30bc166d3ed33d8ba2d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear a single PWM channel interrupt.  <a href="group__hardware__pwm.html#ga8d4482b5e125e30bc166d3ed33d8ba2d">More...</a><br /></td></tr>
<tr class="separator:ga8d4482b5e125e30bc166d3ed33d8ba2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga565a6b6d19b60b10f5a91b11152cc8c2"><td class="memItemLeft" align="right" valign="top">static uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga565a6b6d19b60b10f5a91b11152cc8c2">pwm_get_irq_status_mask</a> (void)</td></tr>
<tr class="memdesc:ga565a6b6d19b60b10f5a91b11152cc8c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get PWM interrupt status, raw for the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350)  <a href="group__hardware__pwm.html#ga565a6b6d19b60b10f5a91b11152cc8c2">More...</a><br /></td></tr>
<tr class="separator:ga565a6b6d19b60b10f5a91b11152cc8c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1c21d122b5605a374644b07d6c7205e6"><td class="memItemLeft" align="right" valign="top">static uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga1c21d122b5605a374644b07d6c7205e6">pwm_get_irq0_status_mask</a> (void)</td></tr>
<tr class="memdesc:ga1c21d122b5605a374644b07d6c7205e6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get PWM interrupt status, raw for the PWM_IRQ_WRAP_0.  <a href="group__hardware__pwm.html#ga1c21d122b5605a374644b07d6c7205e6">More...</a><br /></td></tr>
<tr class="separator:ga1c21d122b5605a374644b07d6c7205e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab23895c8c5a1d73d73e4f1f32e4d255e"><td class="memItemLeft" align="right" valign="top">static uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#gab23895c8c5a1d73d73e4f1f32e4d255e">pwm_irqn_get_status_mask</a> (uint irq_index)</td></tr>
<tr class="memdesc:gab23895c8c5a1d73d73e4f1f32e4d255e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get PWM interrupt status, raw for either PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1.  <a href="group__hardware__pwm.html#gab23895c8c5a1d73d73e4f1f32e4d255e">More...</a><br /></td></tr>
<tr class="separator:gab23895c8c5a1d73d73e4f1f32e4d255e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga457ee599e471a8da59c42f5c26710ff6"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga457ee599e471a8da59c42f5c26710ff6">pwm_force_irq</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga457ee599e471a8da59c42f5c26710ff6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Force PWM interrupt for the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350)  <a href="group__hardware__pwm.html#ga457ee599e471a8da59c42f5c26710ff6">More...</a><br /></td></tr>
<tr class="separator:ga457ee599e471a8da59c42f5c26710ff6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5630f7a5331a0b118ce0a288897b75cc"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga5630f7a5331a0b118ce0a288897b75cc">pwm_force_irq0</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga5630f7a5331a0b118ce0a288897b75cc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Force PWM interrupt via PWM_IRQ_WRAP_0.  <a href="group__hardware__pwm.html#ga5630f7a5331a0b118ce0a288897b75cc">More...</a><br /></td></tr>
<tr class="separator:ga5630f7a5331a0b118ce0a288897b75cc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4ddb2ef5ee40a1f59d35b0f4966fced1"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga4ddb2ef5ee40a1f59d35b0f4966fced1">pwm_irqn_force</a> (uint irq_index, uint slice_num)</td></tr>
<tr class="memdesc:ga4ddb2ef5ee40a1f59d35b0f4966fced1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Force PWM interrupt via PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1.  <a href="group__hardware__pwm.html#ga4ddb2ef5ee40a1f59d35b0f4966fced1">More...</a><br /></td></tr>
<tr class="separator:ga4ddb2ef5ee40a1f59d35b0f4966fced1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga2f600a7192ecd69a8680be367e8d0a00"><td class="memItemLeft" align="right" valign="top">static uint&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__hardware__pwm.html#ga2f600a7192ecd69a8680be367e8d0a00">pwm_get_dreq</a> (uint slice_num)</td></tr>
<tr class="memdesc:ga2f600a7192ecd69a8680be367e8d0a00"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the DREQ to use for pacing transfers to a particular PWM slice.  <a href="group__hardware__pwm.html#ga2f600a7192ecd69a8680be367e8d0a00">More...</a><br /></td></tr>
<tr class="separator:ga2f600a7192ecd69a8680be367e8d0a00"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p >Hardware Pulse Width Modulation (PWM) API. </p>
<p >The RP2040 PWM block has 8 identical slices, the RP2350 has 12. Each slice can drive two PWM output signals, or measure the frequency or duty cycle of an input signal. This gives a total of up to 16/24 controllable PWM outputs. All 30 GPIOs can be driven by the PWM block.</p>
<p >The PWM hardware functions by continuously comparing the input value to a free-running counter. This produces a toggling output where the amount of time spent at the high output level is proportional to the input value. The fraction of time spent at the high signal level is known as the duty cycle of the signal.</p>
<p >The default behaviour of a PWM slice is to count upward until the wrap value (<a class="el" href="group__hardware__pwm.html#gad6cf6d9237144234732a50eb6d5e4fe9">pwm_config_set_wrap</a>) is reached, and then immediately wrap to 0. PWM slices also offer a phase-correct mode, where the counter starts to count downward after reaching TOP, until it reaches 0 again.</p>
<h2><a class="anchor" id="pwm_example"></a>
Example</h2>
<div class="fragment"><div class="line"> </div>
<div class="line"><span class="comment">// Output PWM signals on pins 0 and 1</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="stdlib_8h.html">pico/stdlib.h</a>&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="rp2__common_2hardware__pwm_2include_2hardware_2pwm_8h.html">hardware/pwm.h</a>&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Tell GPIO 0 and 1 they are allocated to the PWM</span></div>
<div class="line">    <a class="code hl_function" href="group__hardware__gpio.html#ga22f6b90c4c7e0013b4b5341de0a44fc4">gpio_set_function</a>(0, <a class="code hl_enumvalue" href="group__hardware__gpio.html#ggaf91b38a4d4e96c343bd16927c34936e0a2c6da3c6851ba4404a812719260b31d2">GPIO_FUNC_PWM</a>);</div>
<div class="line">    <a class="code hl_function" href="group__hardware__gpio.html#ga22f6b90c4c7e0013b4b5341de0a44fc4">gpio_set_function</a>(1, <a class="code hl_enumvalue" href="group__hardware__gpio.html#ggaf91b38a4d4e96c343bd16927c34936e0a2c6da3c6851ba4404a812719260b31d2">GPIO_FUNC_PWM</a>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Find out which PWM slice is connected to GPIO 0 (it&#39;s slice 0)</span></div>
<div class="line">    uint slice_num = <a class="code hl_function" href="group__hardware__pwm.html#ga8b2117d67a544f64c001f4f32c723eef">pwm_gpio_to_slice_num</a>(0);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Set period of 4 cycles (0 to 3 inclusive)</span></div>
<div class="line">    <a class="code hl_function" href="group__hardware__pwm.html#ga6f8fe346e6912cfab3d36b00043a3627">pwm_set_wrap</a>(slice_num, 3);</div>
<div class="line">    <span class="comment">// Set channel A output high for one cycle before dropping</span></div>
<div class="line">    <a class="code hl_function" href="group__hardware__pwm.html#ga18a2b3bbc240d1a9b36526d69c06ec3d">pwm_set_chan_level</a>(slice_num, PWM_CHAN_A, 1);</div>
<div class="line">    <span class="comment">// Set initial B output high for three cycles before dropping</span></div>
<div class="line">    <a class="code hl_function" href="group__hardware__pwm.html#ga18a2b3bbc240d1a9b36526d69c06ec3d">pwm_set_chan_level</a>(slice_num, PWM_CHAN_B, 3);</div>
<div class="line">    <span class="comment">// Set the PWM running</span></div>
<div class="line">    <a class="code hl_function" href="group__hardware__pwm.html#ga216496c331542eb57199018fa86b4408">pwm_set_enabled</a>(slice_num, <span class="keyword">true</span>);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">// Note we could also use pwm_set_gpio_level(gpio, x) which looks up the</span></div>
<div class="line">    <span class="comment">// correct slice and channel for a given GPIO.</span></div>
<div class="line">}</div>
<div class="ttc" id="agroup__hardware__gpio_html_ga22f6b90c4c7e0013b4b5341de0a44fc4"><div class="ttname"><a href="group__hardware__gpio.html#ga22f6b90c4c7e0013b4b5341de0a44fc4">gpio_set_function</a></div><div class="ttdeci">void gpio_set_function(uint gpio, gpio_function_t fn)</div><div class="ttdoc">Select GPIO function.</div><div class="ttdef"><b>Definition:</b> gpio.c:38</div></div>
<div class="ttc" id="agroup__hardware__gpio_html_ggaf91b38a4d4e96c343bd16927c34936e0a2c6da3c6851ba4404a812719260b31d2"><div class="ttname"><a href="group__hardware__gpio.html#ggaf91b38a4d4e96c343bd16927c34936e0a2c6da3c6851ba4404a812719260b31d2">GPIO_FUNC_PWM</a></div><div class="ttdeci">@ GPIO_FUNC_PWM</div><div class="ttdoc">Select PWM as GPIO pin function.</div><div class="ttdef"><b>Definition:</b> io_bank0.h:35</div></div>
<div class="ttc" id="agroup__hardware__pwm_html_ga18a2b3bbc240d1a9b36526d69c06ec3d"><div class="ttname"><a href="group__hardware__pwm.html#ga18a2b3bbc240d1a9b36526d69c06ec3d">pwm_set_chan_level</a></div><div class="ttdeci">static void pwm_set_chan_level(uint slice_num, uint chan, uint16_t level)</div><div class="ttdoc">Set the current PWM counter compare value for one channel.</div><div class="ttdef"><b>Definition:</b> pwm.h:326</div></div>
<div class="ttc" id="agroup__hardware__pwm_html_ga216496c331542eb57199018fa86b4408"><div class="ttname"><a href="group__hardware__pwm.html#ga216496c331542eb57199018fa86b4408">pwm_set_enabled</a></div><div class="ttdeci">static void pwm_set_enabled(uint slice_num, bool enabled)</div><div class="ttdoc">Enable/Disable PWM.</div><div class="ttdef"><b>Definition:</b> pwm.h:546</div></div>
<div class="ttc" id="agroup__hardware__pwm_html_ga6f8fe346e6912cfab3d36b00043a3627"><div class="ttname"><a href="group__hardware__pwm.html#ga6f8fe346e6912cfab3d36b00043a3627">pwm_set_wrap</a></div><div class="ttdeci">static void pwm_set_wrap(uint slice_num, uint16_t wrap)</div><div class="ttdoc">Set the current PWM counter wrap value.</div><div class="ttdef"><b>Definition:</b> pwm.h:306</div></div>
<div class="ttc" id="agroup__hardware__pwm_html_ga8b2117d67a544f64c001f4f32c723eef"><div class="ttname"><a href="group__hardware__pwm.html#ga8b2117d67a544f64c001f4f32c723eef">pwm_gpio_to_slice_num</a></div><div class="ttdeci">static uint pwm_gpio_to_slice_num(uint gpio)</div><div class="ttdoc">Determine the PWM slice that is attached to the specified GPIO.</div><div class="ttdef"><b>Definition:</b> pwm.h:120</div></div>
<div class="ttc" id="arp2__common_2hardware__pwm_2include_2hardware_2pwm_8h_html"><div class="ttname"><a href="rp2__common_2hardware__pwm_2include_2hardware_2pwm_8h.html">pwm.h</a></div></div>
<div class="ttc" id="astdlib_8h_html"><div class="ttname"><a href="stdlib_8h.html">stdlib.h</a></div></div>
</div><!-- fragment --> <h2 class="groupheader">Macro Definition Documentation</h2>
<a id="ga799affc57db362720ea5f4a5aef381f8" name="ga799affc57db362720ea5f4a5aef381f8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga799affc57db362720ea5f4a5aef381f8">&#9670;&nbsp;</a></span>PWM_DEFAULT_IRQ_NUM</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PWM_DEFAULT_IRQ_NUM</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the <a class="el" href="group__hardware__irq.html#gaf30862f51b5994ffd5863176a185d137">irq_num_t</a> for the default PWM IRQ. </p>
<p >On RP2040, there is only one PWM irq: PWM_IRQ_WRAP </p>
<p >On RP2350 this returns to PWM_IRQ_WRAP0 </p>
<p >Note this macro is intended to resolve at compile time, and does no parameter checking </p>

</div>
</div>
<a id="gab346f319fab9342c66d48bdcc9bb7430" name="gab346f319fab9342c66d48bdcc9bb7430"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab346f319fab9342c66d48bdcc9bb7430">&#9670;&nbsp;</a></span>PWM_DREQ_NUM</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PWM_DREQ_NUM</td>
          <td>(</td>
          <td class="paramtype">&#160;</td>
          <td class="paramname">slice_num</td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the <a class="el" href="group__hardware__dma.html#ga8def0ea481095c94f3a0dd0b4fed999e">dreq_num_t</a> used for pacing DMA transfers for a given PWM slice. </p>
<p >Note this macro is intended to resolve at compile time, and does no parameter checking </p>

</div>
</div>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a id="ga0a00197703c8606641488cfff3f660e6" name="ga0a00197703c8606641488cfff3f660e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0a00197703c8606641488cfff3f660e6">&#9670;&nbsp;</a></span>pwm_clkdiv_mode</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">pwm_clkdiv_mode</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>PWM Divider mode settings. </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a id="gga0a00197703c8606641488cfff3f660e6acd3efbc3feaca58b87930008fdd8486b" name="gga0a00197703c8606641488cfff3f660e6acd3efbc3feaca58b87930008fdd8486b"></a>PWM_DIV_FREE_RUNNING&#160;</td><td class="fielddoc"><p >Free-running counting at rate dictated by fractional divider. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga0a00197703c8606641488cfff3f660e6a186c27a4768fcb0c6930471db51861b7" name="gga0a00197703c8606641488cfff3f660e6a186c27a4768fcb0c6930471db51861b7"></a>PWM_DIV_B_HIGH&#160;</td><td class="fielddoc"><p >Fractional divider is gated by the PWM B pin. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga0a00197703c8606641488cfff3f660e6ad9d2170532c2c9ab4016908544c8ad40" name="gga0a00197703c8606641488cfff3f660e6ad9d2170532c2c9ab4016908544c8ad40"></a>PWM_DIV_B_RISING&#160;</td><td class="fielddoc"><p >Fractional divider advances with each rising edge of the PWM B pin. </p>
</td></tr>
<tr><td class="fieldname"><a id="gga0a00197703c8606641488cfff3f660e6a0b4afcaa75090169d3b7cbec4c0e2012" name="gga0a00197703c8606641488cfff3f660e6a0b4afcaa75090169d3b7cbec4c0e2012"></a>PWM_DIV_B_FALLING&#160;</td><td class="fielddoc"><p >Fractional divider advances with each falling edge of the PWM B pin. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga98a47b25fcc2f28addf0a28ee3234efd" name="ga98a47b25fcc2f28addf0a28ee3234efd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga98a47b25fcc2f28addf0a28ee3234efd">&#9670;&nbsp;</a></span>pwm_advance_count()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_advance_count </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Advance PWM count. </p>
<p >Advance the phase of a running the counter by 1 count.</p>
<p >This function will return once the increment is complete.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga8d4482b5e125e30bc166d3ed33d8ba2d" name="ga8d4482b5e125e30bc166d3ed33d8ba2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8d4482b5e125e30bc166d3ed33d8ba2d">&#9670;&nbsp;</a></span>pwm_clear_irq()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_clear_irq </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Clear a single PWM channel interrupt. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga679802450ac829eff368e8f109df387e" name="ga679802450ac829eff368e8f109df387e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga679802450ac829eff368e8f109df387e">&#9670;&nbsp;</a></span>pwm_config_set_clkdiv()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_clkdiv </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>div</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM clock divider in a PWM configuration. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">div</td><td>Value to divide counting rate by. Must be greater than or equal to 1.</td></tr>
  </table>
  </dd>
</dl>
<p>If the divide mode is free-running, the PWM counter runs at clk_sys / div. Otherwise, the divider reduces the rate of events seen on the B pin input (level or edge) before passing them on to the PWM counter. </p>

</div>
</div>
<a id="ga120a17d77d42bb3a0e9e9510677ed61a" name="ga120a17d77d42bb3a0e9e9510677ed61a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga120a17d77d42bb3a0e9e9510677ed61a">&#9670;&nbsp;</a></span>pwm_config_set_clkdiv_int()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_clkdiv_int </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>div_int</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM clock divider in a PWM configuration. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">div_int</td><td>Integer value to reduce counting rate by. Must be greater than or equal to 1 and less than 256.</td></tr>
  </table>
  </dd>
</dl>
<p>If the divide mode is free-running, the PWM counter runs at clk_sys / div. Otherwise, the divider reduces the rate of events seen on the B pin input (level or edge) before passing them on to the PWM counter. </p>

</div>
</div>
<a id="ga87232650c2d7cc3a92bb6cf7a3d0756b" name="ga87232650c2d7cc3a92bb6cf7a3d0756b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga87232650c2d7cc3a92bb6cf7a3d0756b">&#9670;&nbsp;</a></span>pwm_config_set_clkdiv_int_frac4()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_clkdiv_int_frac4 </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>div_int</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>div_frac4</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM clock divider in a PWM configuration using an 8:4 fractional value. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">div_int</td><td>8 bit integer part of the clock divider. Must be greater than or equal to 1. </td></tr>
    <tr><td class="paramname">div_frac4</td><td>4 bit fractional part of the clock divider</td></tr>
  </table>
  </dd>
</dl>
<p>If the divide mode is free-running, the PWM counter runs at clk_sys / div. Otherwise, the divider reduces the rate of events seen on the B pin input (level or edge) before passing them on to the PWM counter. </p>

</div>
</div>
<a id="ga27a86a921b2ad2ebd811db1255d34d06" name="ga27a86a921b2ad2ebd811db1255d34d06"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga27a86a921b2ad2ebd811db1255d34d06">&#9670;&nbsp;</a></span>pwm_config_set_clkdiv_mode()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_clkdiv_mode </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">pwm_clkdiv_mode</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM counting mode in a PWM configuration. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">mode</td><td>PWM divide/count mode</td></tr>
  </table>
  </dd>
</dl>
<p>Configure which event gates the operation of the fractional divider. The default is always-on (free-running PWM). Can also be configured to count on high level, rising edge or falling edge of the B pin input. </p>

</div>
</div>
<a id="gab459185e217d5e215dae3cfb3d6de1b5" name="gab459185e217d5e215dae3cfb3d6de1b5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab459185e217d5e215dae3cfb3d6de1b5">&#9670;&nbsp;</a></span>pwm_config_set_output_polarity()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_output_polarity </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set output polarity in a PWM configuration. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">a</td><td>true to invert output A </td></tr>
    <tr><td class="paramname">b</td><td>true to invert output B </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga031fe8a502c9640ed4f5fab74d6248ae" name="ga031fe8a502c9640ed4f5fab74d6248ae"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga031fe8a502c9640ed4f5fab74d6248ae">&#9670;&nbsp;</a></span>pwm_config_set_phase_correct()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_phase_correct </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>phase_correct</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set phase correction in a PWM configuration. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">phase_correct</td><td>true to set phase correct modulation, false to set trailing edge</td></tr>
  </table>
  </dd>
</dl>
<p>Setting phase control to true means that instead of wrapping back to zero when the wrap point is reached, the PWM starts counting back down. The output frequency is halved when phase-correct mode is enabled. </p>

</div>
</div>
<a id="gad6cf6d9237144234732a50eb6d5e4fe9" name="gad6cf6d9237144234732a50eb6d5e4fe9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad6cf6d9237144234732a50eb6d5e4fe9">&#9670;&nbsp;</a></span>pwm_config_set_wrap()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_config_set_wrap </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>wrap</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM counter wrap value in a PWM configuration. </p>
<p >Set the highest value the counter will reach before returning to 0. Also known as TOP.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">c</td><td>PWM configuration struct to modify </td></tr>
    <tr><td class="paramname">wrap</td><td>Value to set wrap to </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga457ee599e471a8da59c42f5c26710ff6" name="ga457ee599e471a8da59c42f5c26710ff6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga457ee599e471a8da59c42f5c26710ff6">&#9670;&nbsp;</a></span>pwm_force_irq()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_force_irq </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Force PWM interrupt for the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350) </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga5630f7a5331a0b118ce0a288897b75cc" name="ga5630f7a5331a0b118ce0a288897b75cc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5630f7a5331a0b118ce0a288897b75cc">&#9670;&nbsp;</a></span>pwm_force_irq0()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_force_irq0 </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Force PWM interrupt via PWM_IRQ_WRAP_0. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga157c8b11483967714823187725a5ed5a" name="ga157c8b11483967714823187725a5ed5a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga157c8b11483967714823187725a5ed5a">&#9670;&nbsp;</a></span>pwm_get_counter()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint16_t pwm_get_counter </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get PWM counter. </p>
<p >Get current value of PWM counter</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Current value of the PWM counter </dd></dl>

</div>
</div>
<a id="gad76f94a6dd6133c52284b6be8ae98e16" name="gad76f94a6dd6133c52284b6be8ae98e16"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad76f94a6dd6133c52284b6be8ae98e16">&#9670;&nbsp;</a></span>pwm_get_default_config()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="structpwm__config.html">pwm_config</a> pwm_get_default_config </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get a set of default values for PWM configuration. </p>
<p >PWM config is free-running at system clock speed, no phase correction, wrapping at 0xffff, with standard polarities for channels A and B.</p>
<dl class="section return"><dt>Returns</dt><dd>Set of default values. </dd></dl>

</div>
</div>
<a id="ga2f600a7192ecd69a8680be367e8d0a00" name="ga2f600a7192ecd69a8680be367e8d0a00"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2f600a7192ecd69a8680be367e8d0a00">&#9670;&nbsp;</a></span>pwm_get_dreq()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint pwm_get_dreq </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Return the DREQ to use for pacing transfers to a particular PWM slice. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga1c21d122b5605a374644b07d6c7205e6" name="ga1c21d122b5605a374644b07d6c7205e6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1c21d122b5605a374644b07d6c7205e6">&#9670;&nbsp;</a></span>pwm_get_irq0_status_mask()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint32_t pwm_get_irq0_status_mask </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get PWM interrupt status, raw for the PWM_IRQ_WRAP_0. </p>
<dl class="section return"><dt>Returns</dt><dd>Bitmask of all PWM interrupts currently set </dd></dl>

</div>
</div>
<a id="ga565a6b6d19b60b10f5a91b11152cc8c2" name="ga565a6b6d19b60b10f5a91b11152cc8c2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga565a6b6d19b60b10f5a91b11152cc8c2">&#9670;&nbsp;</a></span>pwm_get_irq_status_mask()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint32_t pwm_get_irq_status_mask </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get PWM interrupt status, raw for the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350) </p>
<dl class="section return"><dt>Returns</dt><dd>Bitmask of all PWM interrupts currently set </dd></dl>

</div>
</div>
<a id="ga96ba504fe00cb8e0d88f0730cdfdaafc" name="ga96ba504fe00cb8e0d88f0730cdfdaafc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga96ba504fe00cb8e0d88f0730cdfdaafc">&#9670;&nbsp;</a></span>pwm_gpio_to_channel()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint pwm_gpio_to_channel </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>gpio</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Determine the PWM channel that is attached to the specified GPIO. </p>
<p >Each slice 0 to 7 has two channels, A and B.</p>
<dl class="section return"><dt>Returns</dt><dd>The PWM channel that controls the specified GPIO. </dd></dl>

</div>
</div>
<a id="ga8b2117d67a544f64c001f4f32c723eef" name="ga8b2117d67a544f64c001f4f32c723eef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga8b2117d67a544f64c001f4f32c723eef">&#9670;&nbsp;</a></span>pwm_gpio_to_slice_num()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint pwm_gpio_to_slice_num </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>gpio</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Determine the PWM slice that is attached to the specified GPIO. </p>
<dl class="section return"><dt>Returns</dt><dd>The PWM slice number that controls the specified GPIO. </dd></dl>

</div>
</div>
<a id="ga01d3e90bb7aa9a8b6884eddbfbebc175" name="ga01d3e90bb7aa9a8b6884eddbfbebc175"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga01d3e90bb7aa9a8b6884eddbfbebc175">&#9670;&nbsp;</a></span>pwm_init()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_init </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structpwm__config.html">pwm_config</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>start</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Initialise a PWM with settings from a configuration object. </p>
<p >Use the <a class="el" href="group__hardware__pwm.html#gad76f94a6dd6133c52284b6be8ae98e16">pwm_get_default_config()</a> function to initialise a config structure, make changes as needed using the pwm_config_* functions, then call this function to set up the PWM.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">c</td><td>The configuration to use </td></tr>
    <tr><td class="paramname">start</td><td>If true the PWM will be started running once configured. If false you will need to start manually using <a class="el" href="group__hardware__pwm.html#ga216496c331542eb57199018fa86b4408">pwm_set_enabled()</a> or <a class="el" href="group__hardware__pwm.html#ga257ea7fd33fcf33815a01dd279ca578d">pwm_set_mask_enabled()</a> </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga4ddb2ef5ee40a1f59d35b0f4966fced1" name="ga4ddb2ef5ee40a1f59d35b0f4966fced1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4ddb2ef5ee40a1f59d35b0f4966fced1">&#9670;&nbsp;</a></span>pwm_irqn_force()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_irqn_force </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>irq_index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Force PWM interrupt via PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">irq_index</td><td>the IRQ index; either 0 or 1 for PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1 </td></tr>
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gab23895c8c5a1d73d73e4f1f32e4d255e" name="gab23895c8c5a1d73d73e4f1f32e4d255e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab23895c8c5a1d73d73e4f1f32e4d255e">&#9670;&nbsp;</a></span>pwm_irqn_get_status_mask()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static uint32_t pwm_irqn_get_status_mask </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>irq_index</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Get PWM interrupt status, raw for either PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">irq_index</td><td>the IRQ index; either 0 or 1 for PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Bitmask of all PWM interrupts currently set </dd></dl>

</div>
</div>
<a id="ga2ea24b74474d2a7095ab1a9e409fa85e" name="ga2ea24b74474d2a7095ab1a9e409fa85e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga2ea24b74474d2a7095ab1a9e409fa85e">&#9670;&nbsp;</a></span>pwm_irqn_set_slice_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_irqn_set_slice_enabled </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>irq_index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable PWM instance interrupt via either PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1. </p>
<p >Used to enable a single PWM instance interrupt.</p>
<p >Note there is only one PWM_IRQ_WRAP on RP2040.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">irq_index</td><td>the IRQ index; either 0 or 1 for PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1 </td></tr>
    <tr><td class="paramname">slice_num</td><td>PWM block to enable/disable </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable, false to disable </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga6c5a284b10961cd0f73e22684df691f0" name="ga6c5a284b10961cd0f73e22684df691f0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6c5a284b10961cd0f73e22684df691f0">&#9670;&nbsp;</a></span>pwm_irqn_set_slice_mask_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_irqn_set_slice_mask_enabled </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>irq_index</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_mask</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable PWM instance interrupts via either PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1. </p>
<p >Used to enable a single PWM instance interrupt.</p>
<p >Note there is only one PWM_IRQ_WRAP on RP2040.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">irq_index</td><td>the IRQ index; either 0 or 1 for PWM_IRQ_WRAP_0 or PWM_IRQ_WRAP_1 </td></tr>
    <tr><td class="paramname">slice_mask</td><td>Bitmask of all the blocks to enable/disable. Channel 0 = bit 0, channel 1 = bit 1 etc. </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable, false to disable </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga0dec65009d8c0738677818b680fd2ad9" name="ga0dec65009d8c0738677818b680fd2ad9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0dec65009d8c0738677818b680fd2ad9">&#9670;&nbsp;</a></span>pwm_retard_count()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_retard_count </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Retard PWM count. </p>
<p >Retard the phase of a running counter by 1 count</p>
<p >This function will return once the retardation is complete.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gae7064c88717eee935e50138f5b0ae2b7" name="gae7064c88717eee935e50138f5b0ae2b7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae7064c88717eee935e50138f5b0ae2b7">&#9670;&nbsp;</a></span>pwm_set_both_levels()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_both_levels </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>level_a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>level_b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM counter compare values. </p>
<p >Set the value of the PWM counter compare values, A and B.</p>
<p >The counter compare register is double-buffered in hardware. This means that, when the PWM is running, a write to the counter compare values does not take effect until the next time the PWM slice wraps (or, in phase-correct mode, the next time the slice reaches 0). If the PWM is not running, the write is latched in immediately.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">level_a</td><td>Value to set compare A to. When the counter reaches this value the A output is deasserted </td></tr>
    <tr><td class="paramname">level_b</td><td>Value to set compare B to. When the counter reaches this value the B output is deasserted </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga18a2b3bbc240d1a9b36526d69c06ec3d" name="ga18a2b3bbc240d1a9b36526d69c06ec3d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga18a2b3bbc240d1a9b36526d69c06ec3d">&#9670;&nbsp;</a></span>pwm_set_chan_level()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_chan_level </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>chan</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>level</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the current PWM counter compare value for one channel. </p>
<p >Set the value of the PWM counter compare value, for either channel A or channel B.</p>
<p >The counter compare register is double-buffered in hardware. This means that, when the PWM is running, a write to the counter compare values does not take effect until the next time the PWM slice wraps (or, in phase-correct mode, the next time the slice reaches 0). If the PWM is not running, the write is latched in immediately.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">chan</td><td>Which channel to update. 0 for A, 1 for B. </td></tr>
    <tr><td class="paramname">level</td><td>new level for the selected output </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga94782fc53adb07a3594ae0939d9a2e3e" name="ga94782fc53adb07a3594ae0939d9a2e3e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga94782fc53adb07a3594ae0939d9a2e3e">&#9670;&nbsp;</a></span>pwm_set_clkdiv()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_clkdiv </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>divider</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM clock divider. </p>
<p >Set the clock divider. Counter increment will be on sysclock divided by this value, taking into account the gating.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">divider</td><td>Floating point clock divider, 1.f &lt;= value &lt; 256.f </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga0a2f35d5e2e1ddfd84f2ecab43d765e2" name="ga0a2f35d5e2e1ddfd84f2ecab43d765e2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga0a2f35d5e2e1ddfd84f2ecab43d765e2">&#9670;&nbsp;</a></span>pwm_set_clkdiv_int_frac4()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_clkdiv_int_frac4 </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>div_int</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>div_frac4</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM clock divider using an 8:4 fractional value. </p>
<p >Set the clock divider. Counter increment will be on sysclock divided by this value, taking into account the gating.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">div_int</td><td>8 bit integer part of the clock divider </td></tr>
    <tr><td class="paramname">div_frac4</td><td>4 bit fractional part of the clock divider </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga1ee213ebb13b98dc81e60a512f696227" name="ga1ee213ebb13b98dc81e60a512f696227"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga1ee213ebb13b98dc81e60a512f696227">&#9670;&nbsp;</a></span>pwm_set_clkdiv_mode()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_clkdiv_mode </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__hardware__pwm.html#ga0a00197703c8606641488cfff3f660e6">pwm_clkdiv_mode</a>&#160;</td>
          <td class="paramname"><em>mode</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM divider mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">mode</td><td>Required divider mode </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga5179ec971146ab611b9232587e945769" name="ga5179ec971146ab611b9232587e945769"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5179ec971146ab611b9232587e945769">&#9670;&nbsp;</a></span>pwm_set_counter()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_counter </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>c</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM counter. </p>
<p >Set the value of the PWM counter</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">c</td><td>Value to set the PWM counter to </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga216496c331542eb57199018fa86b4408" name="ga216496c331542eb57199018fa86b4408"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga216496c331542eb57199018fa86b4408">&#9670;&nbsp;</a></span>pwm_set_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_enabled </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable/Disable PWM. </p>
<p >When a PWM is disabled, it halts its counter, and the output pins are left high or low depending on exactly when the counter is halted. When re-enabled the PWM resumes immediately from where it left off.</p>
<p >If the PWM's output pins need to be low when halted:</p>
<ul>
<li>The counter compare can be set to zero whilst the PWM is enabled, and then the PWM disabled once both pins are seen to be low</li>
<li>The GPIO output overrides can be used to force the actual pins low</li>
<li>The PWM can be run for one cycle (i.e. enabled then immediately disabled) with a TOP of 0, count of 0 and counter compare of 0, to force the pins low when the PWM has already been halted. The same method can be used with a counter compare value of 1 to force a pin high.</li>
</ul>
<p >Note that, when disabled, the PWM can still be advanced one count at a time by pulsing the PH_ADV bit in its CSR. The output pins transition as though the PWM were enabled.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable the specified PWM, false to disable. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga279d1ba7dcc8f19619f389317efb41fd" name="ga279d1ba7dcc8f19619f389317efb41fd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga279d1ba7dcc8f19619f389317efb41fd">&#9670;&nbsp;</a></span>pwm_set_gpio_level()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_gpio_level </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>gpio</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>level</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Helper function to set the PWM level for the slice and channel associated with a GPIO. </p>
<p >Look up the correct slice (0 to 7) and channel (A or B) for a given GPIO, and update the corresponding counter compare field.</p>
<p >This PWM slice should already have been configured and set running. Also be careful of multiple GPIOs mapping to the same slice and channel (if GPIOs have a difference of 16).</p>
<p >The counter compare register is double-buffered in hardware. This means that, when the PWM is running, a write to the counter compare values does not take effect until the next time the PWM slice wraps (or, in phase-correct mode, the next time the slice reaches 0). If the PWM is not running, the write is latched in immediately.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">gpio</td><td>GPIO to set level of </td></tr>
    <tr><td class="paramname">level</td><td>PWM level for this GPIO </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga79aa7a5ac3e6960ed1c8eda99cddb1a9" name="ga79aa7a5ac3e6960ed1c8eda99cddb1a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga79aa7a5ac3e6960ed1c8eda99cddb1a9">&#9670;&nbsp;</a></span>pwm_set_irq0_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_irq0_enabled </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable PWM instance interrupt via PWM_IRQ_WRAP_0. </p>
<p >Used to enable a single PWM instance interrupt.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM block to enable/disable </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable, false to disable </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gade21c4c94d2dce96bb4992d818909f0e" name="gade21c4c94d2dce96bb4992d818909f0e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gade21c4c94d2dce96bb4992d818909f0e">&#9670;&nbsp;</a></span>pwm_set_irq0_mask_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_irq0_mask_enabled </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>slice_mask</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable multiple PWM instance interrupts via PWM_IRQ_WRAP_0. </p>
<p >Use this to enable multiple PWM interrupts at once.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_mask</td><td>Bitmask of all the blocks to enable/disable. Channel 0 = bit 0, channel 1 = bit 1 etc. </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable, false to disable </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga093a3c371dda3aa2291331147337265e" name="ga093a3c371dda3aa2291331147337265e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga093a3c371dda3aa2291331147337265e">&#9670;&nbsp;</a></span>pwm_set_irq_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_irq_enabled </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable PWM instance interrupt via the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350) </p>
<p >Used to enable a single PWM instance interrupt.</p>
<p >Note there is only one PWM_IRQ_WRAP on RP2040.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM block to enable/disable </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable, false to disable </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gac32a9b468ddbd49bad6ebff6789fd215" name="gac32a9b468ddbd49bad6ebff6789fd215"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gac32a9b468ddbd49bad6ebff6789fd215">&#9670;&nbsp;</a></span>pwm_set_irq_mask_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_irq_mask_enabled </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>slice_mask</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>enabled</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable multiple PWM instance interrupts via the default PWM IRQ (PWM_IRQ_WRAP_0 on RP2350) </p>
<p >Use this to enable multiple PWM interrupts at once.</p>
<p >Note there is only one PWM_IRQ_WRAP on RP2040.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_mask</td><td>Bitmask of all the blocks to enable/disable. Channel 0 = bit 0, channel 1 = bit 1 etc. </td></tr>
    <tr><td class="paramname">enabled</td><td>true to enable, false to disable </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga257ea7fd33fcf33815a01dd279ca578d" name="ga257ea7fd33fcf33815a01dd279ca578d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga257ea7fd33fcf33815a01dd279ca578d">&#9670;&nbsp;</a></span>pwm_set_mask_enabled()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_mask_enabled </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>mask</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Enable/Disable multiple PWM slices simultaneously. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mask</td><td>Bitmap of PWMs to enable/disable. Bits 0 to 7 enable slices 0-7 respectively </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gab12ab09d76aed43a36f973232718fdd6" name="gab12ab09d76aed43a36f973232718fdd6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab12ab09d76aed43a36f973232718fdd6">&#9670;&nbsp;</a></span>pwm_set_output_polarity()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_output_polarity </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM output polarity. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">a</td><td>true to invert output A </td></tr>
    <tr><td class="paramname">b</td><td>true to invert output B </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="gacb2a1995f0bfdb12345607b903c3f11e" name="gacb2a1995f0bfdb12345607b903c3f11e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gacb2a1995f0bfdb12345607b903c3f11e">&#9670;&nbsp;</a></span>pwm_set_phase_correct()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_phase_correct </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>phase_correct</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set PWM phase correct on/off. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">phase_correct</td><td>true to set phase correct modulation, false to set trailing edge</td></tr>
  </table>
  </dd>
</dl>
<p>Setting phase control to true means that instead of wrapping back to zero when the wrap point is reached, the PWM starts counting back down. The output frequency is halved when phase-correct mode is enabled. </p>

</div>
</div>
<a id="ga6f8fe346e6912cfab3d36b00043a3627" name="ga6f8fe346e6912cfab3d36b00043a3627"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6f8fe346e6912cfab3d36b00043a3627">&#9670;&nbsp;</a></span>pwm_set_wrap()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void pwm_set_wrap </td>
          <td>(</td>
          <td class="paramtype">uint&#160;</td>
          <td class="paramname"><em>slice_num</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>wrap</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Set the current PWM counter wrap value. </p>
<p >Set the highest value the counter will reach before returning to 0. Also known as TOP.</p>
<p >The counter wrap value is double-buffered in hardware. This means that, when the PWM is running, a write to the counter wrap value does not take effect until after the next time the PWM slice wraps (or, in phase-correct mode, the next time the slice reaches 0). If the PWM is not running, the write is latched in immediately.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">slice_num</td><td>PWM slice number </td></tr>
    <tr><td class="paramname">wrap</td><td>Value to set wrap to </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->

	<script src="main.js"></script>
</body>
</html>